<template>
  <span class="root">
    <!-- 左侧 -->
    <div class="l-content">
      <!-- 展示图标 -->
      <el-button @click="handleCollapse" size="small">
        <!-- el-icon的size大小要加“:”，看文档 -->
        <el-icon :size="20">
          <Menu />
        </el-icon>
      </el-button>

      <!-- 面包屑 -->
      <h3>首页</h3>
    </div>

    <!-- 右侧 -->
    <div class="r-content">
      <el-dropdown>
        <span class="el-dropdown-link">
          <img src="../assets/vue.svg" alt class="user" />
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item>个人中心</el-dropdown-item>
            <el-dropdown-item>退出</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </span>
</template>

<script>
import {computed} from 'vue'
import { useStore } from "vuex";
export default {
  setup() {
    const store = useStore()
    const handleCollapse = () => {
      store.commit('updateIsCollapse')
    };
    const current = computed(()=>{
      return store.state.currentMenu
    })
    return { handleCollapse,current  };
  }
};
</script>

<style lang="less" scoped>
span.root {
  display: flex;
  justify-content: space-between;
  align-items: center;

  width: 100%;
  background-color: #333;
  padding: 20px 10px;
  // border-radius: 10px;
  margin: 0;
}

.r-content {
  .user {
    width: 40px;
    height: 40px;
    border-radius: 25%;
    // background-color: rgba(11, 226, 79, 0.504);
  }
}

.l-content {
  display: flex;
  align-items: center;
  .el-button {
    margin-right: 20px;
  }
  h3 {
    color: #fff;
  }
}
</style>